#include <stdio.h>
#include <stdlib.h>

#include "ExtremeC_examples_chapter8_3_student.h"

int main(int argc, char** argv) {
    //创建并构造学生对象
    struct student_t* student = student_new();
    student_ctor(student, "John", "Doe", 1987, "TA5667", 134);
    //我们必须使用 student 的行为函数，因为 student 指针不是 person 指针，我们不能在
    //student 对象中访问私有 parent 指针
    char buffer[32];
    student_get_first_name(student, buffer);
    printf("First name: %s\n", buffer);

    student_get_last_name(student, buffer);
    printf("Last name: %s\n", buffer);

    printf("Birth year: %d\n", student_get_birth_year(student));
    
    student_get_student_number(student, buffer);
    printf("Student number: %s\n", buffer);

    printf("Passed credits: %d\n", student_get_passed_creadits(student));

    //析构并释放学生对象
    student_dtor(student);
    free(student);

    return 0;
}